{{- define "main" -}}

{{/* Check that user fully installed Hugo Blox Builder. */}}
{{/* Commented out to allow user to have no params.yaml and just use the defaults. */}}
{{/* if not (isset site.Params "seo") */}}
  {{/* errorf "Please complete the installation of Hugo Blox Builder by following the steps at https://hugoblox.com/docs/install/" */}}
{{/* end */}}

{{/* Deprecation warnings */}}

{{/* v4.5: Address changed from string to map. */}}
{{ if isset site.Params "address" }}
{{ if eq (reflect.IsMap site.Params.address) false }}
  {{ errorf "Please upgrade the `address` field in `config/_default/params.toml`. Refer to all of the Breaking Changes in v4.5 at https://hugoblox.com/updates/v4.5.0/" }}
{{ end }}
{{ end }}

{{/* Generate homepage. */}}
{{ if eq .Type "book" }}
  {{ partial "book_layout.html" . }}
{{ else if eq .Type "landing" }}
  {{ partial "landing_page.html" . }}
{{ else }}
  {{/* If no homepage file is present, fallback to legacy widget page */}}
  {{ partial "widget_page.html" . }}
{{ end }}

{{- end -}}
